-
Notifications
You must be signed in to change notification settings - Fork 4k
.Net: Introduce support for response modalities and audio options in AzureClientCore
#12523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
.Net: Introduce support for response modalities and audio options in AzureClientCore
#12523
Conversation
Introduce methods to handle response modalities and audio options in AzureClientCore. Add checks for executionSettings.Modalities and executionSettings.Audio to dynamically configure options based on user settings. Implement GetResponseModalities and GetAudioOptions methods to support various input formats, improving flexibility and robustness.
AzureClientCore
AzureClientCore
@microsoft-github-policy-service agree |
This is for this request #11720 |
@Cobra86 Thank you for adding the support, to get those one in, we also need Unit Tests similar how we do have for OpenAI Connector. Please add those. Overall LGTM. |
Implemented tests in `AzureOpenAIChatCompletionServiceTests` to verify the correct handling of audio content in requests and responses. This includes checks for sending audio content, processing audio responses, and handling audio metadata. Introduced new theory data members for validating response modalities and audio options.
@RogerBarreto Thank you :). I've added the tests same as OpenAI. Please let me know if i need more tests |
dotnet/src/Connectors/Connectors.AzureOpenAI/Core/AzureClientCore.ChatCompletion.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Connectors/Connectors.AzureOpenAI/Core/AzureClientCore.ChatCompletion.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Connectors/Connectors.AzureOpenAI/Core/AzureClientCore.ChatCompletion.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a couple small comments about error messaging, to help users troubleshoot failures.
Enhance error handling by introducing try-catch blocks for JSON deserialization, providing clearer exception messages for unsupported modalities and invalid audio options. Refactor parsing logic for string modalities to improve code readability and maintainability.
Thanks. I've made the changes. Please review it and let me know. |
Motivation and Context
This change extends
AzureClientCore
to handle response modalities and audio options dynamically based on user-providedexecutionSettings
.Why this is needed:
Currently, the OpenAI connector supports audio modalities through the
Modalities
andAudio
properties inOpenAIPromptExecutionSettings
, but the Azure OpenAI connector doesn't fully implement this functionality.The code for handling audio exists in
AzureClientCore.cs
but isn't included inAzureClientCore.ChatCompletion.cs
.Description
Introduced
GetResponseModalities
andGetAudioOptions
helper methods. These follow the same logic as the equivalent methods in the OpenAI connector to ensure consistent behaviour and reduce duplication across both clients.Updated
CreateChatCompletionOptions
to:ResponseModalities
if specified inexecutionSettings
.AudioOptions
if specified inexecutionSettings
.Contribution Checklist